Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: checkpoints_loaded:{checkpoint:state_dict}, model.load_state_dict issue in dict value empty #13535

Merged
merged 2 commits into from
Oct 14, 2023

Conversation

chu8129
Copy link
Contributor

@chu8129 chu8129 commented Oct 7, 2023

Description

  • my understanding: checkpoints_loaded: use to cache state_dict
  • bug: model.load_state_dict(state_dict, strict=False) change state_dict to {}
  • reason: use with sd_disable_initialization.LoadStateDictOnMeta, will clean state_dict
  • fix: took the easier way, move cache code in front of model.load_state_dict(state_dict, strict=False),by the way, use deepcopy



Screenshots/videos:

the original error

autodl-fs/sd-data/extensions/sd-webui-controlnet/scripts/hook.py", line 850, in forward_webui
        return forward(*args, **kwargs)
      File "/root/autodl-fs/sd-data/extensions/sd-webui-controlnet/scripts/hook.py", line 591, in forward
        control = param.control_model(x=x_in, hint=hint, timesteps=timesteps, context=context, y=y)
      File "/root/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/root/autodl-fs/sd-data/extensions/sd-webui-controlnet/scripts/cldm.py", line 31, in forward
        return self.control_model(*args, **kwargs)
      File "/root/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/root/autodl-fs/sd-data/extensions/sd-webui-controlnet/scripts/cldm.py", line 304, in forward
        assert y.shape[0] == x.shape[0]
    AttributeError: 'NoneType' object has no attribute 'shape'

Explain

 set checkpoint cache size:6
 use sdxl and sdxl controlnet, normal
 change, use sd1.5 normal
 change, use sdxl and sdxl controlnet, checkpoints cache in ram, raise error
   -  code:load from cache, get state_dict is {}
   -  code:adjust model type, sdxl key not in state_dict, set model.is_sdxl = False, real model is previous model sd1.5
   -  code:but, controlnet use sdxl canny, y value must be not none, then, raise error



print str(state_dict)[:100] for monitor

use master branch code:ERROR


    with sd_disable_initialization.LoadStateDictOnMeta(state_dict, device=model_target_device(sd_model), weight_dtype_conversion=weight_dtype_conversion):
        load_model_weights(sd_model, checkpoint_info, state_dict, timer)

pay attention to:after map(in sd_disable_initialization.py), the state_dict has been change

clip_is_included_into_sd:True, shared.cmd_opts.do_not_download_clip:False
self.filename:/root/autodl-fs/sd-data/models/Stable-diffusion/7EhrMEzi5YX.safetensors, checkpoint/7EhrMEzi5YX.safetensors
load_model_weights <modules.sd_models.CheckpointInfo object at 0x7f5e086257e0> model.is_sdxl False
before load model load_state_dict {'cond_stage_model.transformer.text_model.embeddings.position_embedding.weight': tensor([[ 0.0016,
model.load_state_dict /root/autodl-fs/qwcache/stable-diffusion-webui/modules/sd_disable_initialization.py
before map {'cond_stage_model.transformer.text_model.embeddings.position_embedding.weight': tensor(..., device=
load_state_dict torch before load OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch after load OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch del load OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch after strict OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch _IncompatibleKeys OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
after map {'cond_stage_model.transformer.text_model.embeddings.position_embedding.weight': tensor(..., device=
after load model load_state_dict state_dict {}
after load model load_state_dict state_dict {}

without sd_disable_initialization.LoadStateDictOnMeta:NORMAL

    load_model_weights(sd_model, checkpoint_info, state_dict, timer)
clip_is_included_into_sd:True, shared.cmd_opts.do_not_download_clip:False
self.filename:/root/autodl-fs/sd-data/models/Stable-diffusion/epicrealism_pureEvolutionV5.safetensors, checkpoint/epicrealism_pureEvolutionV5.safetensors
load_model_weights <modules.sd_models.CheckpointInfo object at 0x7f9f34629ae0> model.is_sdxl False
before load model load_state_dict {'cond_stage_model.transformer.text_model.embeddings.position_embedding.weight': tensor([[ 0.0016,
model.load_state_dict /root/miniconda3/lib/python3.10/site-packages/torch/nn/modules/module.py
load_state_dict torch before load OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch after load OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch del load OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch after strict OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
load_state_dict torch _IncompatibleKeys OrderedDict([('cond_stage_model.transformer.text_model.embeddings.position_embedding.weight', tensor
after load model load_state_dict state_dict {'cond_stage_model.transformer.text_model.embeddings.position_embedding.weight': tensor([[ 0.0016,
after load model load_state_dict state_dict {'cond_stage_model.transformer.text_model.embeddings.position_embedding.weight': tensor([[ 0.0016,
shared.opts.sd_checkpoint_cache 6

MR && with sd_disable_initialization.LoadStateDictOnMeta:NORMAL

(load_state_dict still change state_dict to {}, but did not effect the follow code)
load from cache correctly

Applying attention optimization: xformers... done.
Model loaded in 14.0s (create model: 0.5s, apply weights to model: 13.2s).
Reusing loaded model 7EhrMEzi5YX.safetensors [732d0dd2cf] to load sd_xl_base_1.0.safetensors [31e35c80fc]
Loading weights [31e35c80fc] from cache
Creating model from config: /root/autodl-fs/sd-data/models/Stable-diffusion/sd_xl_base_1.0.yaml
...
instantiate_from_config done
load_state_dict torch before load OrderedDict([('conditioner.embedders.0.transformer.text_model.embeddings.position_embedding.weight',
load_state_dict torch after load OrderedDict([('conditioner.embedders.0.transformer.text_model.embeddings.position_embedding.weight',
load_state_dict torch del load OrderedDict([('conditioner.embedders.0.transformer.text_model.embeddings.position_embedding.weight',
load_state_dict torch after strict OrderedDict([('conditioner.embedders.0.transformer.text_model.embeddings.position_embedding.weight',
load_state_dict torch _IncompatibleKeys OrderedDict([('conditioner.embedders.0.transformer.text_model.embeddings.position_embedding.weight',
after load model load_state_dict state_dict  {}
Loading VAE weights found near the checkpoint: cached sd_xl_base_1.0.vae.safetensors

Checklist:

anyone can explain this? module_load_state_dict did not declare, how did it run?

in modules/sd_disable_initialization.py
        module_load_state_dict = self.replace(torch.nn.Module, 'load_state_dict', lambda *args, **kwargs: load_state_dict(module_load_state_dict, *args, **kwargs))

wangqiuwen added 2 commits October 7, 2023 15:36
@chu8129 chu8129 requested a review from AUTOMATIC1111 as a code owner October 7, 2023 07:58
@chu8129 chu8129 changed the title fix: checkpoints_loaded:{checkpoint:state_dict} after model.load_state_dict issue in dict value empty fix: checkpoints_loaded:{checkpoint:state_dict}, model.load_state_dict issue in dict value empty Oct 7, 2023
@FurkanGozukara
Copy link

i am having hard time to get SDXL loaded on 13 gb RAM machine - 14 GB GPU

is this fixing it?

@wkpark
Copy link
Contributor

wkpark commented Oct 11, 2023

no need to use deepcopy(), state_dict.copy() works

checkpoints_loaded[checkpoint_info] = state_dict.copy()

@chu8129
Copy link
Contributor Author

chu8129 commented Oct 12, 2023

i am having hard time to get SDXL loaded on 13 gb RAM machine - 14 GB GPU

is this fixing it?

can u paste error info here?

@chu8129
Copy link
Contributor Author

chu8129 commented Oct 12, 2023

no need to use deepcopy(), state_dict.copy() works

checkpoints_loaded[checkpoint_info] = state_dict.copy()

for safety; topic:shallow copying

@AUTOMATIC1111 AUTOMATIC1111 merged commit 7cc9642 into AUTOMATIC1111:dev Oct 14, 2023
3 checks passed
AUTOMATIC1111 added a commit that referenced this pull request Oct 14, 2023
@AUTOMATIC1111
Copy link
Owner

So the error is if you have Checkpoints to cache in RAM set to 2, and start with checkpoint A, then switch to checkpoint B, then switch back to checkpoint A again, it will still keep using checkpoint B's weights.

Ans we don't want to use deepcopy here because it would use extra RAM.

@w-e-w w-e-w mentioned this pull request Dec 4, 2023
@w-e-w w-e-w mentioned this pull request Dec 16, 2023
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this pull request Jan 25, 2024
* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this pull request Jan 25, 2024
* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this pull request Jan 25, 2024
* pull (#11)

* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>

* Z (#12)

* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* fix gradio video component and canvas fit for inpaint

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
martianunlimited added a commit to martianunlimited/stable-diffusion-webui-ux that referenced this pull request Jan 25, 2024
* fix IndexError: list index out of range error interrupted while postprocess

* added option to play notification sound or not

* Convert (emphasis) to (emphasis:1.1)

per @SirVeggie's suggestion

* Make attention conversion optional

Fix square brackets multiplier

* put notification.mp3 option at the end of the page

* more general case of adding an infotext when no images have been generated

* use shallow copy for AUTOMATIC1111#13535

* remove duplicated code

* support webui.settings.bat

* Start / Restart generation by Ctrl (Alt) + Enter

Add ability to interrupt current generation and start generation again by Ctrl (Alt) + Enter

* add an option to not print stack traces on ctrl+c.

* repair unload sd checkpoint button

* respect keyedit_precision_attention setting when converting from old (((attention))) syntax

* Update script.js

Exclude lambda

* Update script.js

LF instead CRLF

* Update script.js

* Add files via upload

LF

* wip incorrect OFT implementation

* inference working but SLOW

* faster by using cached R in forward

* faster by calculating R in updown and using cached R in forward

* refactor: fix constraint, re-use get_weight

* style: formatting

* style: fix ambiguous variable name

* rework some of changes for emphasis editing keys, force conversion of old-style emphasis

* fix the situation with emphasis editing (aaaa:1.1) bbbb (cccc:1.1)

* fix bug when using --gfpgan-models-path

* fix Blank line contains whitespace

* refactor: use forward hook instead of custom forward

* fix: return orig weights during updown, merge weights before forward

* fix: support multiplier, no forward pass hook

* style: cleanup oft

* fix: use merge_weight to cache value

* refactor: remove used OFT functions

* fix: multiplier applied twice in finalize_updown

* style: conform style

* Update prompts_from_file script to allow concatenating entries with the general prompt.

* linting issue

* call state.jobnext() before postproces*()

* Fix AUTOMATIC1111#13796

Fix comment error that makes understanding scheduling more confusing.

* test implementation based on kohaku diag-oft implementation

* detect diag_oft type

* no idea what i'm doing, trying to support both type of OFT, kblueleaf diag_oft has MultiheadAttn which kohya's doesn't?, attempt create new module based off network_lora.py, errors about tensor dim mismatch

* added accordion settings options

* Fix parenthesis auto selection

Fixes AUTOMATIC1111#13813

* Update requirements_versions.txt

* skip multihead attn for now

* refactor: move factorization to lyco_helpers, separate calc_updown for kohya and kb

* refactor: use same updown for both kohya OFT and LyCORIS diag-oft

* refactor: remove unused function

* correct a typo

modify "defaul" to "default"

* add a visible checkbox to input accordion

* eslint

* properly apply sort order for extra network cards when selected from dropdown
allow selection of default sort order in settings
remove 'Default' sort order, replace with 'Name'

* Add SSD-1B as a supported model

* Added memory clearance after deletion

* Use devices.torch_gc() instead of empty_cache()

* added compact prompt option

* compact prompt option disabled by default

* linter

* more changes for AUTOMATIC1111#13865: fix formatting, rename the function, add comment and add a readme entry

* fix img2img_tabs error

* fix exception related to the pix2pix

* Add option to set notification sound volume

* fix pix2pix producing bad results

* moved nested with to single line to remove extra tabs

* removed changes that weren't merged properly

* multiline with statement for readibility

* Update README.md

Modify the stablediffusion dependency address

* Update README.md

Modify the stablediffusion dependency address

* - opensuse compatibility

* Enable prompt hotkeys in style editor

* Compatibility with Debian 11, Fedora 34+ and openSUSE 15.4+

* fix added accordion settings options

* ExitStack as alternative to suppress

* implementing script metadata and DAG sorting mechanism

* populate loaded_extensions from extension list instead

* reverse the extension load order so builtin extensions load earlier natively

* add hyperTile

https://github.com/tfernd/HyperTile

* remove the assumption of same name

* allow comma and whitespace as separator

* fix

* bug fix

* dir buttons start with / so only the correct dir will be shown and not dirs with a substrings as name from the dir

* Lint

* Fixes generation restart not working for some users when 'Ctrl+Enter' is pressed

* Adds 'Path' sorting for Extra network cards

* hotfix: call shared.state.end() after postprocessing done

* Implement Hypertile

Co-Authored-By: Kieran Hunt <kph@hotmail.ca>

* copy LDM VAE key from XL

* fix: ignore calc_scale() for COFT which has very small alpha

* feat: LyCORIS/kohya OFT network support

* convert/add hypertile options

* fix ruff - add newline

* Adds tqdm handler to logging_config.py for progress bar integration

* Take into account tqdm not being installed before first boot for logging

* actually adds handler to logging_config.py

* Fix critical issue - unet apply

* Fix inverted option issue

I'm pretty sure I was sleepy while implementing this

* set empty value for SD XL 3rd layer

* fix double gc and decoding with unet context

* feat: fix randn found element of type float at pos 2

Signed-off-by: storyicon <storyicon@foxmail.com>

* use metadata.ini for meta filename

* Option to show batch img2img results in UI

shared.opts.img2img_batch_show_results_limit
limit the number of images return to the UI for batch img2img
default limit 32
0 no images are shown
-1 unlimited, all images are shown

* save sysinfo as .json

GitHub now allows uploading of .json files in issues

* rework extensions metadata: use custom sorter that doesn't mess the order as much and ignores cyclic errors, use classes with named fields instead of dictionaries, eliminate some duplicated code

* added option for default behavior of dir buttons

* Add FP32 fallback support on sd_vae_approx

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the submodule may require additional modifications. The following is the example modification on the other submodule.

```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py

class Upsample(nn.Module):
..snip..
    def forward(self, x):
        assert x.shape[1] == self.channels
        if self.dims == 3:
            x = F.interpolate(
                x, (x.shape[2], x.shape[3] * 2, x.shape[4] * 2), mode="nearest"
            )
        else:
            try:
                x = F.interpolate(x, scale_factor=2, mode="nearest")
            except:
                x = F.interpolate(x.to(th.float32), scale_factor=2, mode="nearest").to(x.dtype)
        if self.use_conv:
            x = self.conv(x)
        return x
..snip..
```

You can see the FP32 fallback execution as same as sd_vae_approx.py.

* fix  [Bug]: (Dev Branch) Placing "Dimensions" first in "ui_reorder_list" prevents start AUTOMATIC1111#14047

* Update ruff to 0.1.6

* Simplify restart_sampler (suggested by ruff)

* use extension name for determining an extension is installed in the index

* Move exception_records related methods to errors.py

* remove traceback in sysinfo

* move file

* rework hypertile into a built-in extension

* do not save HTML explanations from options page to config

* fix linter errors

* compact prompt layout: preserve scroll when switching between lora tabs

* json.dump(ensure_ascii=False)

improve json readability

* add categories to settings

* also consider extension url

* add Block component creation callback

* catch uncaught exception with ui creation scripts

prevent total webui crash

* Allow use of mutiple styles csv files

* bugfix for warning message (#6)

* bugfix for warning message (#6)

* bugfix for warning message

* bugfix error message

* Allow use of mutiple styles csv files
* AUTOMATIC1111#14122
Fix edge case where style text has multiple {prompt} placeholders
* AUTOMATIC1111#14005

* Support XYZ scripts / split hires path from unet

* cache divisors / fix ruff

* fix ruff in hypertile_xyz.py

* fix ruff - set comprehension

* hypertile_xyz: we don't need isnumeric check for AxisOption

* Update devices.py

fixes issue where "--use-cpu" all properly makes SD run on CPU but leaves ControlNet (and other extensions, I presume) pointed at GPU, causing a crash in ControlNet caused by a mismatch between devices between SD and CN

AUTOMATIC1111#14097

* fix Auto focal point crop for opencv >= 4.8.x

autocrop.download_and_cache_models
in opencv >= 4.8 the face detection model was updated
download the base on opencv version
returns the model path or raise exception

* reformat file with uniform indentation

* Revert "Add FP32 fallback support on sd_vae_approx"

This reverts commit 58c1954.
Since the modification is expected to move to mac_specific.py
(AUTOMATIC1111#14046 (comment))

* Add FP32 fallback support on torch.nn.functional.interpolate

This tries to execute interpolate with FP32 if it failed.

Background is that
on some environment such as Mx chip MacOS devices, we get error as follows:

```
"torch/nn/functional.py", line 3931, in interpolate
        return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    RuntimeError: "upsample_nearest2d_channels_last" not implemented for 'Half'
```

In this case, ```--no-half``` doesn't help to solve. Therefore this commits add the FP32 fallback execution to solve it.

Note that the ```upsample_nearest2d``` is called from ```torch.nn.functional.interpolate```.
And the fallback for torch.nn.functional.interpolate is necessary at
```modules/sd_vae_approx.py``` 's ```VAEApprox.forward```
```repositories/stable-diffusion-stability-ai/ldm/modules/diffusionmodules/openaimodel.py``` 's ```Upsample.forward```

* Fix the Ruff error about unused import

* Initial IPEX support

* add max-heigh/width to global-popup-inner

prevent the pop-up from being too big as to making exiting the pop-up impossible

* Close popups with escape key

* Fix bug where is_using_v_parameterization_for_sd2 fails because the sd_hijack is only partially undone

* Add support for SD 2.1 Turbo, by converting the state dict from SGM to LDM on load

* infotext updates: add option to disregard certain infotext fields, add option to not include VAE in infotext, add explanation to infotext settings page, move some options to infotext settings page

* Disable ipex autocast due to its bad perf

* split UI settings page into many

* put code that can cause an exception into its own function for AUTOMATIC1111#14120

* Fix fp64

* extras tab batch: actually use original filename
preprocessing upscale: do not do an extra upscale step if it's not needed

* Remove webui-ipex-user.bat

* remove Train/Preprocessing tab and put all its functionality into extras batch images mode

* potential fix for AUTOMATIC1111#14172

* alternate implementation for unet forward replacement that does not depend on hijack being applied

* Fix `save_samples` being checked early when saving masked composite

* Re-add setting lost as part of e294e46

* rework mask and mask_composite logic

* Add import_hook hack to work around basicsr incompatibility

Fixes AUTOMATIC1111#13985

* Update launch_utils.py to fix wrong dep. checks and reinstalls

Fixes failing dependency checks for extensions having a different package name and import name (for example ffmpeg-python / ffmpeg), which currently is causing the unneeded reinstall of packages at runtime.

In fact with current code, the same string is used when installing a package and when checking for its presence, as you can see in the following example:

> launch_utils.run_pip("install ffmpeg-python", "required package")
[ Installing required package: "ffmpeg-python" ... ]
[ Installed ]

> launch_utils.is_installed("ffmpeg-python")
False

... which would actually return true with:

> launch_utils.is_installed("ffmpeg")
True

* Lint

* make webui not crash when running with --disable-all-extensions option

* update changelog

* repair old handler for postprocessing API

* repair old handler for postprocessing API in a way that doesn't break interface

* add hypertile infotext

* Merge pull request AUTOMATIC1111#14203 from AUTOMATIC1111/remove-clean_text()

remove clean_text()

* fix Inpaint Image Appears Behind Some UI Elements anapnoe#206

* fix side panel show/hide button hot zone does not use the entire width anapnoe#204

* Merge pull request AUTOMATIC1111#14300 from AUTOMATIC1111/oft_fixes

Fix wrong implementation in network_oft

* Merge pull request AUTOMATIC1111#14296 from akx/paste-resolution

Allow pasting in WIDTHxHEIGHT strings into the width/height fields

* Merge pull request AUTOMATIC1111#14270 from kaalibro/extra-options-elem-id

Assign id for "extra_options". Replace numeric field with slider.

* Merge pull request AUTOMATIC1111#14276 from AUTOMATIC1111/fix-styles

Fix styles

* Merge pull request AUTOMATIC1111#14266 from kaalibro/dev

Re-add setting lost as part of e294e46

* Merge pull request AUTOMATIC1111#14229 from Nuullll/ipex-embedding

[IPEX] Fix embedding and ControlNet

* Merge pull request AUTOMATIC1111#14230 from AUTOMATIC1111/add-option-Live-preview-in-full-page-image-viewer

add option: Live preview in full page image viewer

* Merge pull request AUTOMATIC1111#14216 from wfjsw/state-dict-ref-comparison

change state dict comparison to ref compare

* Merge pull request AUTOMATIC1111#14237 from ReneKroon/dev

AUTOMATIC1111#13354 : solve lora loading issue

* Merge pull request AUTOMATIC1111#14307 from AUTOMATIC1111/default-Falst-js_live_preview_in_modal_lightbox

default False js_live_preview_in_modal_lightbox

* update to 1.7 from upstream

* Update README.md

* Update screenshot.png

* Update CITATION.cff

* update to latest version

* update to latest version

---------

Signed-off-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Won-Kyu Park <wkpark@gmail.com>
Co-authored-by: Gleb Alekseev <alekseev.gleb@gmail.com>
Co-authored-by: missionfloyd <missionfloyd@users.noreply.github.com>
Co-authored-by: AUTOMATIC1111 <16777216c@gmail.com>
Co-authored-by: Khachatur Avanesian <jailbreakvideo@gmail.com>
Co-authored-by: v0xie <28695009+v0xie@users.noreply.github.com>
Co-authored-by: avantcontra <dadadaluo@gmail.com>
Co-authored-by: David Benson <dben@users.noreply.github.com>
Co-authored-by: Meerkov <GoMeerkov@gmail.com>
Co-authored-by: Emily Zeng <zhixuan.zeng@gmail.com>
Co-authored-by: w-e-w <40751091+w-e-w@users.noreply.github.com>
Co-authored-by: gibiee <37574274+gibiee@users.noreply.github.com>
Co-authored-by: Ritesh Gangnani <riteshgangnani10>
Co-authored-by: GerryDE <gerritfresen4@gmail.com>
Co-authored-by: fuchen.ljl <yjqqqqdx_01@163.com>
Co-authored-by: Alessandro de Oliveira Faria (A.K.A. CABELO) <cabelo@opensuse.org>
Co-authored-by: wfjsw <wfjsw@users.noreply.github.com>
Co-authored-by: aria1th <35677394+aria1th@users.noreply.github.com>
Co-authored-by: Tom Haelbich <65122811+h43lb1t0@users.noreply.github.com>
Co-authored-by: kaalibro <konstantin.adamovich@gmail.com>
Co-authored-by: AngelBottomless <aria1th@naver.com>
Co-authored-by: Kieran Hunt <kph@hotmail.ca>
Co-authored-by: Lucas Daniel Velazquez M <19197331+Luxter77@users.noreply.github.com>
Co-authored-by: Your Name <you@example.com>
Co-authored-by: storyicon <storyicon@foxmail.com>
Co-authored-by: Tom Haelbich <haelbito@outlook.com>
Co-authored-by: hidenorly <twitte.harold@gmail.com>
Co-authored-by: Aarni Koskela <akx@iki.fi>
Co-authored-by: Charlie Joynt <cjj1977@users.noreply.github.com>
Co-authored-by: obsol <33932119+read-0nly@users.noreply.github.com>
Co-authored-by: Nuullll <vfirst218@gmail.com>
Co-authored-by: MrCheeze <fishycheeze@yahoo.ca>
Co-authored-by: catboxanon <122327233+catboxanon@users.noreply.github.com>
Co-authored-by: illtellyoulater <3078931+illtellyoulater@users.noreply.github.com>
Co-authored-by: anapnoe <124302297+anapnoe@users.noreply.github.com>
ruchej pushed a commit to ruchej/stable-diffusion-webui that referenced this pull request Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants